﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using HiLand.Utility.Drawing;
using HiLand.Utility.IO;

namespace WebDemo
{
    public partial class WaterMarkDemo : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            string fileToOperate = this.MapPath("~/Downs/fileToDown.jpg");
            System.Drawing.Image imageToOperate = System.Drawing.Image.FromFile(fileToOperate);
            Stream stream = WaterMarker.AddWaterMarkText(imageToOperate,"xieran@青岛", WaterMarkPositions.RightBottom,0.9F,90);
            FileHelper.WriteStreamToFile(stream, "C:\\" + Guid.NewGuid().ToString() + ".jpg");
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            string fileToOperate = this.MapPath("~/Downs/fileToDown.jpg");
            string fileOfWaterMark = this.MapPath("~/Downs/watermarker.jpg");
            System.Drawing.Image imageToOperate = System.Drawing.Image.FromFile(fileToOperate);
            Stream stream = WaterMarker.AddWaterMarkImage(imageToOperate, fileOfWaterMark, WaterMarkPositions.RightBottom, 0.9F, 90);
            FileHelper.WriteStreamToFile(stream, "C:\\" + Guid.NewGuid().ToString() + ".jpg");
        }
    }
}